﻿using System;
using System.Collections.Generic;
using System.Text;

namespace RemoteCode
{
    internal class IdGenerator
    {
        internal Random rnd;

        public IdGenerator()
        {
            rnd = new Random(DateTime.Now.Millisecond);
        }

        public int Generate(IList<int> list)
        {
            int value = rnd.Next(int.MinValue, int.MaxValue);
            while (list.Contains(value) || value == 0) value = rnd.Next(int.MinValue, int.MaxValue);
            return value;
        }
    }
}
